<style>
    #categories-table tbody td {
        cursor: pointer;
    }

    #categories-table tbody tr.selected td {
        background-color: #38b6d0 !important;
        color: #fff;
    }

    #categories-table tbody tr.selected td .text-muted {
        color: #eee;
    }
    #collections_tbl_list tbody tr.active td{
        background-color: #c5fffa !important;
        border-top: 1px solid #004ec9 !important;
        border-bottom: 1px solid #004ec9 !important;
    }
    li{
        list-style-type: none;
    }
    #collections_tbl_list tbody tr.row_error td{
        background-color: #ff4610;
        /*border-top: 1px solid #004ec9 !important;
        border-bottom: 1px solid #004ec9 !important;*/
    }

    .save_row_btn,.split_payment_btn,.delete_row_btn{
        padding: 2px 6px;
    }
    .delete_row_btn{
        margin-left: 2px;
    }
    .input-sm{
        padding: 1px 3px !important;
    }
    .panel .table tr.editing td, .panel .table tr.saving td{
        padding: 2px 7px !important;
    }
    .panel .table-striped > thead th {
        background: #e5e7eb !important;
        border-right: 1px solid #c1c5c9;
    }
    .row_currency{
        margin-right: 2px;
    }
    .row_payment_type{
        margin-right: 2px;
    }
    .row_amount{
        margin-right: 0px !important;
    }
    .td-incell{
        margin-top: 7px;
        font-weight: bold;
    }

    .panel .table td, .panel .table th {
        padding: 6px 5px;
    }
    .input-s-m {
        width: 80px;
    }
</style>

<div class="" id="container">

    <?php echo $this->element('contributions/jump_menu'); ?>

    <div class="row">
        <div class="col-lg-12">
            <section class="panel">
                <header class="panel-heading">
                    <h3>Today's Contributions,
                        <?php echo date('D M d, Y'); ?>
                    </h3>
                </header>
                <div class="row text-sm wrapper">
                    <div class="col-sm-6 m-b-xs">
                        <form class="bs-example form-inline" id="collection_form_settings" onsubmit="return false;">
                            <div class="form-group">
                                <div class="btn-group" data-toggle="buttons">
                                    <label class="btn btn-sm btn-success active">
                                        <input type="radio" name="collection_entry_types" id="single_entry" value="single_entry"> <i class="fa fa-check text-active"></i> Single Entry
                                    </label>
                                    <label class="btn btn-sm btn-default">
                                        <input type="radio" name="collection_entry_types" id="bulk_entry" value="bulk_entry"> <i class="fa fa-check text-active"></i> Bulk Entry
                                    </label>
                                </div>
                            </div>
                            <div class="form-group" id="bulk_receipt_no_container" style="display: none">
                                <input type="text" id="bulk_receipt_no" class="input-sm form-control input-s" placeholder="Enter Bulk Receipt No">
                            </div>
                        </form>
                    </div>
                    <div class="col-sm-3 m-b-xs">
                        <button class="btn btn-info btn-sm" id="btn_new_collection">
                            <i class="fa fa-plus text"></i>
                            <span class="text">Add New</span>
                        </button>
                        <!-- <button class="btn btn-info" id="btn_save_all_collection">
                             <i class="fa fa-save text"></i>
                             <span class="text">Save All</span>
                         </button>-->
                    </div>
                    <div class="col-sm-3">
                        <select class="input-sm form-control m-b inline" id="filter_contribution_types">
                            <option value="0">
                                -- Filter Contribution Type --
                            </option>
                            <?php
                            foreach ($list as $item) {
                                $selected = $contribution_type_filter == $item['id'] ? 'selected=selected' : '';
                                ?>
                                <option  value="<?php echo $item['id']; ?>"  <?php echo $selected; ?> >
                                    <?php echo $item['name']; ?>
                                </option>
                                <?php
                            }
                            ?>
                        </select>
                        <!--  <button class="btn btn-sm btn-white" id="apply_contribution_type_filter_btn">Apply Filter</button>
              
                          <div class="input-group">
                              <input type="text" class="input-sm form-control" placeholder="Search">
                                  <span class="input-group-btn">
                                      <button class="btn btn-sm btn-white" type="button">Go!</button>
                                  </span>
                          </div>-->
                    </div>
                </div>
                <div class="col-lg-12">
                    <div class="panel">
                        <p class="font-bold text-sm text-info m-t-sm m-l-sm">
                            <i class="fa fa-info-circle"></i>
                            <span>Note: <?php echo $receipt_mode_note; ?></span>
                        </p>
                        <div class="table-responsive">
                            <table class="table table-striped b-t text-sm" id="collections_tbl_list">
                                <thead>
                                    <tr>
                                        <th width="8%">Receipt Date</th>
                                        <th width="9%">Receipt No.</th>
                                        <th width="10%">Type</th>
                                        <th width="10%">Member No.</th>
                                        <th width="5%">Week</th>
                                        <th width="5%">Month</th>
                                        <th width="5%">Year</th>
                                        <th width="22%">Payment Type</th>
                                        <th width="18%">Amount</th>
                                        <th width="8%">Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php
                                    foreach ($collection_list as $item) {
                                        ?>
                                        <tr>
                                            <td><?php echo $item['receipt_dt']; ?></td>
                                            <td><?php echo $item['receipt_no']; ?></td>
                                            <td><?php echo $item['type']; ?></td>
                                            <td><?php echo $item['organisation_no']; ?></td>
                                            <td><?php echo $item['week']; ?></td>
                                            <td><?php echo $item['month']; ?></td>
                                            <td><?php echo $item['year']; ?></td>
                                            <td><?php echo $item['payment_type'].' &nbsp; '; echo (!empty($item['cheque_no']))? '( '.$item['cheque_no'].' ) '.$item['cheque_status']:''; ?></td>
                                            <td><?php echo $item['currency_code'].' '.$item['amount']; ?></td>
                                            <td>
                                                <i class="fa fa-check text-success fa-1x"></i>
                                            </td>
                                        </tr>
                                        <?php
                                    }
                                    ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <!-- <footer class="panel-footer">
                     <div class="row">
                         <div class="col-sm-4 hidden-xs">
                             <select class="input-sm form-control input-s-sm inline">
                                 <option value="0">Bulk action</option>
                                 <option value="1">Delete selected</option>
                                 <option value="2">Bulk edit</option>
                                 <option value="3">Export</option>
                             </select>
                             <button class="btn btn-sm btn-white">Apply</button>
                         </div>
                         <div class="col-sm-4 text-center">
                             <small class="text-muted inline m-t-sm m-b-sm">showing 20-30 of 50 items</small>
                         </div>
                         <div class="col-sm-4 text-right text-center-xs">
                             <ul class="pagination pagination-sm m-t-none m-b-none">
                                 <li><a href="#"><i class="fa fa-chevron-left"></i></a></li>
                                 <li><a href="#">1</a></li>
                                 <li><a href="#">2</a></li>
                                 <li><a href="#">3</a></li>
                                 <li><a href="#">4</a></li>
                                 <li><a href="#">5</a></li>
                                 <li><a href="#"><i class="fa fa-chevron-right"></i></a></li>
                             </ul>
                         </div>
                     </div>
                 </footer>-->

                <!-- Modal -->
                <div class="modal fade bs-example-modal-sm" id="split_payment_modal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
                    <div class="modal-dialog modal-sm">
                        <div class="modal-content">

                        </div>
                    </div>
                </div>

            </section>

        </div>
    </div>

</div>

<input type="hidden" id="collections_url" value="<?php echo $this->Html->url(array('action' => 'collections')); ?>"/>
<input type="hidden" id="contacts-autocomplete-url" value="<?php echo $this->Html->url(array('action' => 'members_list')); ?>"/>
<input type="hidden" id="set_new_receipt_counter_url" value="<?php echo $this->Html->url(array('action' => 'set_receipt_counter')); ?>"/>
<script type="application/javascript">
    var contribution_types = <?php echo json_encode($list); ?>;
    var weeks = <?php echo json_encode($weeks); ?>;
    var months = <?php echo json_encode($months); ?>;
    var years = <?php echo json_encode($years); ?>;
    var cur_week = <?php echo json_encode($cur_week); ?>;
    var cur_month = <?php echo json_encode($cur_month); ?>;
    var cur_year = <?php echo json_encode($cur_year); ?>;
    var default_currency = <?php echo json_encode($default_currency); ?>;
    var currencies_list = <?php echo json_encode($currencies_list); ?>;
    var receipt_settings = <?php echo json_encode($receipt_settings); ?>;
    var payment_types = <?php echo json_encode($payment_types); ?>;
</script>
<?php
/* echo $this->Html->script('plugins/jquery.trocar/jquery.trocar.js');
  echo $this->Html->script('plugins/jquery.friendurl/jquery.friendurl.min.js'); */
echo $this->Html->script('app/views/organisations/collections.js');
?>